;====================================================================
;
; Ogre3D Wrapper for Blitz3D
;
; Lights
;
;====================================================================
Const LT_POINT		= 0
Const LT_DIRECTIONAL= 1
Const LT_SPOT		= 2


Function CreateLight%(typ% = LT_POINT, parent% = 0)
	ent.TEntity = New TEntity
	ogre_entity_count = ogre_entity_count + 1
	
	ent\ptr = o_createLight(ogre3d\ogre_scenemanager)
	o_light_setType(ent\ptr, typ)
	
	ent\typ			= ET_LIGHT
	ent\lightType	= typ%
	
	If parent > 0 Then EntityParent(Handle(ent), parent)
	
	Return Handle(ent)
End Function


Function AmbientLight(red#, green#, blue#)
	Local col.TColor = New TColor
	col\r = red
	col\g = green
	col\b = blue
	col\a = 1.0
	
	o_setAmbientLight(ogre3d\ogre_scenemanager, col)
End Function


Function LightColor(light%, red#, green#, blue#)
	Local e.TEntity = Object.TEntity(light)
	o_light_setDiffuseColour(e\ptr, red, green, blue)
End Function


Function LightRange(light%, range#)
	Local e.TEntity = Object.TEntity(light)
	
	Select e\lightType
		Case LT_POINT
			o_light_setAttenuation(e\ptr, range, 0.1, 0.007, 0.0)
		Case LT_SPOT
			o_setSpotlightRange(e\ptr, range, range, 1.0)
	End Select
End Function


Function LightConeAngles(light%, inner_angle#, outer_angle#)
	Local e.TEntity = Object.TEntity(light)
	o_setSpotlightRange(e\ptr, inner_angle, outer_angle, 1.0)
End Function


Function LightShadowRange(light%, nearShadowDistance# = 0.1, farShadowDistance# = 100.0)
	Local e.TEntity = Object.TEntity(light)
	o_light_setShadowNearClipDistance(e\ptr, nearShadowDistance)
	o_light_setShadowFarClipDistance(e\ptr, farShadowDistance)
End Function
;~IDEal Editor Parameters:
;~C#Blitz3D